package com.yunfangdata.web.controller;

import com.yunfangdata.domain.Attendance;
import com.yunfangdata.query.QueryObject;
import com.yunfangdata.service.IAttendanceService;
import com.yunfangdata.util.JsonResult;
import com.yunfangdata.util.PageResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

@Controller
@RequestMapping("attendance")
public class AttendanceController {


    @Autowired
    private IAttendanceService service;


    @RequestMapping("")
    public String index() {
        return "attendance/list";
    }



    @RequestMapping("list")
    @ResponseBody
    public PageResult list(QueryObject qo) {

        return service.query(qo);
    }


    @RequestMapping("save")
    @ResponseBody
    public JsonResult save(Attendance attendance) {
        JsonResult result = new JsonResult();
        try {
            service.save(attendance);
        } catch (Exception e) {
            e.printStackTrace();
            result = new JsonResult("操作失败");
        }
        return result;

    }


}












